-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Azure Container Apps session execute new api-version #8249
Azure Container Apps session execute new api-version #8249
Conversation
|
rule | cmd_name | rule_message | suggest_message |
---|---|---|---|
containerapp session code-interpreter delete-file | cmd containerapp session code-interpreter delete-file added parameter path |
||
containerapp session code-interpreter show-file-content | cmd containerapp session code-interpreter show-file-content added parameter path |
||
containerapp session code-interpreter show-file-metadata | cmd containerapp session code-interpreter show-file-metadata added parameter path |
||
containerapp session code-interpreter upload-file | cmd containerapp session code-interpreter upload-file added parameter path |
Hi @yitaopan, |
Thank you for your contribution! We will review the pull request and get back to you soon. |
CodeGen Tools Feedback CollectionThank you for using our CodeGen tool. We value your feedback, and we would like to know how we can improve our product. Please take a few minutes to fill our codegen survey |
Hi @yitaopan Release SuggestionsModule: containerapp
Notes
|
@@ -1018,7 +1017,7 @@ def list(cls, cmd, resource_group_name, environment_name): | |||
|
|||
|
|||
class SessionPoolPreviewClient(): | |||
api_version = SESSION_API_VERSION | |||
api_version = PREVIEW_API_VERSION |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will ask azure cli folks help to merge this PR: #8223
It will have some conflict with your PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR has been merge. Please resolve the conflict.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Merged and conflicts resolved.
request_url = url_fmt.format( | ||
session_pool_endpoint, | ||
"path=" + path + "&" if path is not None else "", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"path=" + path + "&" if path is not None else "", | |
f"path={path}&" if path is not None else "", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
def show_file_content(cls, cmd, identifier, filename, session_pool_endpoint): | ||
url_fmt = "{}/files/content/{}?identifier={}&api-version={}" | ||
def show_file_content(cls, cmd, identifier, filename, path, session_pool_endpoint): | ||
url_fmt = "{}/files/{}/content?{}identifier={}&api-version={}" |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
request_url = url_fmt.format( | ||
session_pool_endpoint, | ||
filename, | ||
"path=" + path + "&" if path is not None else "", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"path=" + path + "&" if path is not None else "", | |
f"path={path}&" if path is not None else "", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
request_url = url_fmt.format( | ||
session_pool_endpoint, | ||
filename, | ||
"path=" + path + "&" if path is not None else "", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"path=" + path + "&" if path is not None else "", | |
f"path={path}&" if path is not None else "", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
@@ -435,7 +435,7 @@ def load_arguments(self, _): | |||
with self.argument_context('containerapp session code-interpreter', arg_group='file') as c: | |||
c.argument('filename', help="The file to delete or show from the session") | |||
c.argument('filepath', help="The local path to the file to upload to the session") | |||
c.argument('path', help="The path to list files from the session") | |||
c.argument('path', help="The path of files in the session") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Recommend to add an example for --path
in the _help.py
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
if self.get_argument_timeout_in_seconds() is not None: | ||
self.session_code_interpreter_def["properties"]["timeoutInSeconds"] = self.get_argument_timeout_in_seconds() | ||
self.session_code_interpreter_def["timeoutInSeconds"] = self.get_argument_timeout_in_seconds() | ||
else: | ||
self.session_code_interpreter_def["properties"]["timeoutInSeconds"] = 60 | ||
self.session_code_interpreter_def["properties"]["code"] = self.get_argument_code() | ||
self.session_code_interpreter_def["timeoutInSeconds"] = 60 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The self.get_argument_timeout_in_seconds()
will never be None
because there is a default value:
--timeout-in-seconds : Duration in seconds code in session can run prior to timing out
0 - 60 secs, e.g. 30. Default: 60.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make sense, fixed.
request_url = url_fmt.format( | ||
session_pool_endpoint, | ||
filename, | ||
"path=" + path + "&" if path is not None else "", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as L1186
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, fixed
src/containerapp/HISTORY.rst
Outdated
@@ -7,6 +7,8 @@ upcoming | |||
* 'az containerapp create': Fix Role assignment error when the default Azure Container Registry could not be found | |||
* Upgrade api-version to 2024-10-02-preview | |||
* 'az containerapp create/update': `--yaml` support property pollingInterval and cooldownPeriod | |||
* 'az containerapp session code-interpreter': `--path` support upload-file/list-files/show-file-content/show-file-metadata/delete-file for code interpreter sessions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* 'az containerapp session code-interpreter': `--path` support upload-file/list-files/show-file-content/show-file-metadata/delete-file for code interpreter sessions | |
* 'az containerapp session code-interpreter upload-file/list-files/show-file-content/show-file-metadata/delete-file': Support `--path` to specify the path of code interpreter session |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
"code": None, | ||
"timeoutInSeconds": None | ||
} | ||
"codeInputType": None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
with one property identifier
removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The backend Api is switched to use 2024-10-02-preview in this PR, in which the identifier property is removed in the payload, but still exists in the query parameter.
@@ -119,10 +109,5 @@ def test_containerapp_session_code_interpreter_nodelts_e2e(self, resource_group) | |||
resource_group, | |||
)) | |||
|
|||
self.cmd("containerapp sessionpool delete -n {} -g {} --yes".format( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why remove the deletion code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is to remove the deletion of that earlier created PythonLTS session pool https://github.com/Azure/azure-cli-extensions/pull/8249/files/dd6dc3deae0818beb7408a423208e136fd4d31a2#r1836222120
@@ -96,7 +86,7 @@ def test_containerapp_session_code_interpreter_nodelts_e2e(self, resource_group) | |||
identifier_name, | |||
"cert.txt"), | |||
checks=[ | |||
JMESPathCheck('properties.filename', 'cert.txt'), | |||
JMESPathCheck('name', 'cert.txt'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
such change is breaking for cli users. Can we make sure there is no change for cli command output?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are breaking changes in the output of these commands in api-version 2024-10-02-preview, which is reviewed by swagger and sdk team.
The HISTORY.rst file is updated for this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even there is breaking change in swagger, we should still avoid breaking change in cli commands. Discussed with hong, given there is no cli usage, we could allow cli breaking change this time. But in the future, with increasing cli users, such breaking change is not allowed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, understood, will keep in mind for this in the future.
@@ -25,16 +25,6 @@ def test_containerapp_session_code_interpreter_nodelts_e2e(self, resource_group) | |||
sessionpool_list = self.cmd("containerapp sessionpool list -g {}".format(resource_group)).get_output_in_json() | |||
self.assertTrue(len(sessionpool_list) == 0) | |||
|
|||
# Create PythonLTS SessionPool with default container type which is PythonLTS | |||
sessionpool_name_pythonlts = self.create_random_name(prefix='sppythonlts', length=24) | |||
self.cmd('containerapp sessionpool create -g {} -n {} --cooldown-period {}'.format( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why remove this command?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because I think this file should be focusing on NodeLTS session pool, and all the validation is targeting NodeLTS pool rather than the Python session pool created here.
And for the tests and validations against PythonLTS session pools are duplicated in another test file test_containerapp_session_code_interpreter.py.
JMESPathCheck('status', 'Succeeded'), | ||
JMESPathCheck('result.stdout', 'Hello world\n') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
avoid such breaking change. recommend to transform output for consistence
@classmethod | ||
def extract_path_from_filename(cls, path, filename): | ||
if '/' not in filename: | ||
return path, filename | ||
path_in_filename, filename = filename.rsplit('/', 1) | ||
if path is None: | ||
return path_in_filename, filename | ||
else: | ||
return path.rstrip("/") + "/" + path_in_filename.lstrip('/'), filename |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be a static method.
@classmethod | |
def extract_path_from_filename(cls, path, filename): | |
if '/' not in filename: | |
return path, filename | |
path_in_filename, filename = filename.rsplit('/', 1) | |
if path is None: | |
return path_in_filename, filename | |
else: | |
return path.rstrip("/") + "/" + path_in_filename.lstrip('/'), filename | |
@staticmethod | |
def extract_path_from_filename(path, filename): | |
if '/' not in filename: | |
return path, filename | |
path_in_filename, filename = filename.rsplit('/', 1) | |
if path is None: | |
return path_in_filename, filename | |
full_path = f"{path.rstrip('/')}/{path_in_filename.lstrip('/')}" | |
return full_path, filename |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, fixed
Hi @yonzhan @zhoxing-ms |
/azp run |
Azure Pipelines successfully started running 2 pipeline(s). |
@@ -1281,6 +1287,16 @@ def list_files(cls, cmd, identifier, path, session_pool_endpoint): | |||
|
|||
r = send_raw_request(cmd.cli_ctx, "GET", request_url, resource=SESSION_RESOURCE) | |||
return r.json() | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CI style failed
src/containerapp/azext_containerapp/_clients.py:1290:0: C0303: Trailing whitespace (trailing-whitespace)
remove the whitespece
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, fixed
/azp run |
Azure Pipelines successfully started running 2 pipeline(s). |
This checklist is used to make sure that common guidelines for a pull request are followed.
Related command
az containerapp session code-interpreter
General Guidelines
azdev style <YOUR_EXT>
locally? (pip install azdev
required)python scripts/ci/test_index.py -q
locally? (pip install wheel==0.30.0
required)For new extensions:
About Extension Publish
There is a pipeline to automatically build, upload and publish extension wheels.
Once your pull request is merged into main branch, a new pull request will be created to update
src/index.json
automatically.You only need to update the version information in file setup.py and historical information in file HISTORY.rst in your PR but do not modify
src/index.json
.